<template>
	<view class="home">
		<view class="title">
			<view class="title_top">
				<image class="img" src="../../static/images/5sd4f56.png" mode=""></image>
				<view class="text">
					<view class="top">
						{{my}}
					</view>
					<!-- 					<view class="bom">
						15966889999
					</view> -->
				</view>
			</view>
			<!-- 			<view class="title_bom">
				<view class="item">
					<view class="top">
						{{subscribe.textl}}
					</view>
					<view class="bom">
						订阅
					</view>
				</view>
				<view class="item">
					<view class="top">
						{{subscribe.textco}}
					</view>
					<view class="bom">
						报警
					</view>
				</view>
				<view class="item">
					<view class="top">
						{{subscribe.textr}}
					</view>
					<view class="bom">
						巡视
					</view>
				</view>
			</view> -->
		</view>
<!-- 		<view class="shuiliu">
			<view class="shuiliu_l" @click="zhandian">

				<uni-icons type="plusempty" size="40" color="#586ae8"></uni-icons>
				<view class="top">
					新建站点
				</view>

			</view>
			<view class="shuiliu_l" @click="scanQRCode">

				<uni-icons type="scan" size="40" color="#586ae8"></uni-icons>
				<view class="top">
					绑定设备
				</view>
			</view>
		</view> -->
		<view class="ylzitem" @click="liusuyiFn">
			<image class="img" src="../../static/home/liusuyi.png" mode=""></image>
			<view class="text">
				流速仪管理
			</view>
			<view class="text1">
				添加流速仪
			</view>
			<uni-icons type="right" size="30" color="#9c9c9c"></uni-icons>
		</view>
		<view class="ylzitem" @click="cezhanFn">
			<image class="img" src="../../static/home/cezhan.png" mode=""></image>
			<view class="text">
				测站管理
			</view>
			<view class="text1">
				添加测站
			</view>
			<uni-icons type="right" size="30" color="#9c9c9c"></uni-icons>
		</view>
		<view class="ylzitem" @click="shensougan">
			<image class="img" src="../../static/images/liusub.png" mode=""></image>
			<view class="text">
				自动伸缩杆
			</view>
			<view class="text1">
				蓝牙控制设备
			</view>
			<uni-icons type="right" size="30" color="#9c9c9c"></uni-icons>
		</view>
<!-- 		<view class="details">
			<view class="details_item">
				<view class="item_l">
					<image class="item_l_img" src="@/static/my/fuzer.png" mode=""></image>
					<view class="text">
						负责人：
					</view>
				</view>

				<view class="item_co">
					张三
				</view>
				<view class="item_r">
					<uni-icons type="right" size="20" color="#c2c2c2"></uni-icons>
				</view>
			</view>
		</view> -->
		<view class="" style="padding: 30rpx;">
			<u-button type="primary" shape="circle" text="退出登录" @click="exitLogin"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// show: false,
				my: '',
				// projectName:''
			}
		},
		onLoad(option) {
			this.my = this.vuex_usernameLogin
			console.log(this.my);
		},
		methods: {
			shensougan(){
				if (this.vuex_devicename == '') {
					uni.showToast({
						title: '蓝牙未连接',
						duration: 2000
					});
					return
				}
				uni.navigateTo({
					url: '/pages/home/shensuogan'
				});
			},
			liusuyiFn(){
				uni.navigateTo({
					url: '/pagesA/aproductA/saveLiusuyiList'
				});
			},
			cezhanFn(){
				uni.navigateTo({
					url: '/pages/cezhanguanli/increase'
				});
			},
			scanQRCode() {
				uni.scanCode({
					success: (res) => {
						console.log(res.result);
						 this.codeRes(res.result)
						 // 打印扫码结果
						// 在这里可以对扫码结果进行处理
					},
					fail: (res) => {
						console.log(res);
						// 处理扫码失败的情况
					}
				});
			},
			codeRes(id){
				uni.navigateTo({
					url: '/pages/my/bindDevice?id=' + id
				});
			},
			// 确定
			// btnAClick(){
			// 	this.show = false
			// 	console.log('确定');
			// 	uni.$u.http.post('/device/project/add', {
			// 		"projectName": this.projectName
			// 	}).then(res => {
			// 		console.log('res',res);
			// 		if (res.code == 200) {

			// 		}
			// 	}).catch(err => {
			// 		console.log('错误', err);
			// 	})
			// },
			// 取消
			// cancellation(){
			// 	this.show = false
			// },
			// 弹窗
			// change(e) {
			// 	console.log('change', e);
			// },
			zhandian() {
				//在起始页面跳转到test.vue页面并传递参数
				uni.navigateTo({
					url: '/pages/my/zhanDian'
				});

			},
			exitLogin() {
				uni.$u.vuex('vuex_token', '')
				uni.$u.vuex('vuex_login', 0)
				uni.$u.vuex('vuex_user', {})
				uni.reLaunch({
					url: '/pages/home/login'
				});
			}
		}
	}
</script>
<style scoped lang="scss">
	.home {
		// padding: 0 30rpx;

		.title {
			// background-color: #ffffff;
			padding: 30rpx;
			margin-bottom: 30rpx;

			.title_top {
				display: flex;
				align-items: center;
				padding: 20rpx;

				.img {
					width: 120rpx;
					height: 120rpx;
					border-radius: 150rpx;
					border: 5rpx solid #fff;
					margin-right: 40rpx;
					// box-shadow: 0rpx 0rpx 10rpx 5rpx rgba(0, 0, 0, 0.1);
				}

				.text {
					.top {
						font-size: 40rpx;
						color: #000000;
					}

				}
			}

			.title_bom {
				padding: 20rpx;
				display: flex;
				justify-content: space-around;
				align-items: center;

				.item {
					text-align: center;

					.top {
						font-size: 60rpx;
						color: #444f93;
					}
				}
			}
		}

		.shuiliu {
			display: flex;
			justify-content: space-around;
			align-items: center;
			margin-top: 20rpx;
			padding: 20rpx;

			.shuiliu_l {
				// width: 320rpx;
				padding: 50rpx;
				border-radius: 50rpx;
				background-color: #ffffff;

				.top {
					padding: 10rpx;
					line-height: 100rpx;
					border-radius: 20rpx;
					font-size: 50rpx;
					color: #2b2d41;
				}
			}
		}

		.details {
			padding: 30rpx;
			margin: 30rpx;
			background-color: #fff;
			border-radius: 30rpx;

			.details_item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 10rpx;

				.item_l {
					display: flex;
					align-items: center;

					.item_l_img {
						width: 40rpx;
						height: 40rpx;
						margin-right: 30rpx;
					}

					.text {
						width: 150rpx;
						line-height: 80rpx;
						// background-color: #dfdfdf;
						text-align-last: justify;
					}
				}

				.item_co {
					// background-color: #758a94;
					font-size: 40rpx;
				}

				.item_r {}
			}
		}
	}
	.ylzitem {
		margin: 15rpx 40rpx;
		padding: 30rpx;
		border-radius: 40rpx;
		background-color: #fff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		.img{
			width: 60rpx;
			height: 60rpx;
		}
		.text {
			font-size: 45rpx;
			color: #000000;
		}
		.text1 {
			font-size: 30rpx;
			color: #989898;
		}
	}
</style>
<style>
	@font-face {
		font-family: 'MyFont';
		src: url('@/static/fonts/LED.otf');
	}

	page {
		background-color: #f5f6fd;
	}
</style>